package com.tts.superstar;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

import com.tts.superstar.R;
import com.tts.superstar.View.BaseActivity;
import com.tts.superstar.fragment.RegionFragment;
import com.tts.superstar.fragment.ZhuantiFragment;
import com.tts.superstar.fragment.kechengFragment;

public class ResourceActivity extends BaseActivity {

    ImageView mIvReturn;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_resource);
        setFragment(new ZhuantiFragment());

        Button button1 = (Button) findViewById(R.id.btn_zt);
        button1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                setFragment(new ZhuantiFragment());
            }
        });
        Button button2 =(Button)findViewById(R.id.btn_kc);
        button2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                setFragment(new kechengFragment());
            }
        });

        mIvReturn = findViewById(R.id.iv_return);
        mIvReturn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }



    void setFragment(Fragment fragment) {
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
        fragmentTransaction.replace(R.id.resource_fragment, fragment);
        fragmentTransaction.commit();
    }
}
